var template = `
<div v-is="'style'">
    {{cssData}}
</div>
`;


let Css = {
    name: 'Css',
    data() {
        return {
            cssData: `
        .task h2 {
            font-size: 14px;
            color: yellow;
        }
    `
        }
    },
    components: {},
    template,
    mounted: () => {
        const {proxy} = Vue.getCurrentInstance();
        console.log('%s mounted', proxy.$options.name);
        // proxy.doGetCss();
        proxy.cssData = `
#app-main .nav h1 {
    color: red;
}

#app-main .menu a {
    margin: 5px;
}

#app-main button {
    margin: 5px;
}

/*    message    */
#app-message {
    position: absolute;
    right: 5%;
    top: 5%;
    z-index: 99999;
}

#app-message .message .content {
    background: rgba(255, 255, 255, 0.7);
    border: solid 1px rgba(0, 0, 0, 0.7);
    border-radius: 10px;
    padding: 5px;
    margin: 5px;
    min-width: 120px;
    text-align: center;
    word-break: break-all;
    max-width: 200px;

}

#app-message .message .text {
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.15);
    margin-top: -2px;
}

#app-message .message button {
    border-radius: 10px;
    border: solid 1px black;
    height: 22px;
    width: 22px;
    position: relative;
    right: 0px;
    margin-top: -1px;
    float: right;
    margin-bottom: -2px;
}

#app-message .message .error {
    border-color: red;
    color: red;
}

#app-message .message .success {
    border-color: green;
    color: green;
}

/*config*/
#app-main .config h2 {
    font-size: 14px;
}

/*ins-crack*/
#app-main .ins-crack h2 {
    font-size: 14px;
}

#app-main .ins-crack textarea {
    min-height: 200px;
    width: 85%;
}

/*form*/
#app-main .form {
    margin-bottom: 5px;
    max-width: 400px;
    border: solid 1px;
}

#app-main .form .label {
    margin: 5px;
    float: left;
    max-width: 150px;
    min-width: 100px;
    padding: 1px;
}

#app-main .form .input {
    margin: 5px;
    float: right;
    width: 200px;
}

#app-main .form button {
    float: right;
}

#app-main .form .key {
    width: 64px;
}

#app-main .form .value {
    width: 84px;
}

#app-main .form .del {
    margin-left: -5px;
    margin-top: 2px;
    float: inherit;
    width: 22px;
}

#app-main .form .add {
    width: 22px;
    margin-right: 6px;
}

/*list*/
#app-main .list table {
    border-right: 1px solid;
    border-bottom: 1px solid;
}

#app-main .list table td, th {
    border-left: 1px solid;
    border-top: 1px solid;
    word-break: break-all;
}

#app-main .list table .green {
    background-color: green;
}

/*proxy*/
#app-main .proxy h2 {
    font-size: 14px;
}

/*task*/
#app-main .task h2 {
    font-size: 14px;
}

/*user*/
#app-main .user h2 {
    font-size: 14px;
}

/*user*/
#app-main .notify-email h2 {
    font-size: 14px;
}

/*runner*/
#app-main .runner hr {
    border: none;
}

/*task.health*/
#app-main .health .message {
    border: none;
}

#app-main .health .health-true {
    color: green;
}

#app-main .health .health-false {
    color: red;
}

#app-main .crack hr {
    border-style: solid;
    border-width: 1px 0px 0px 0px;
}

#app-main .crack .true {
    color: green;
}

#app-main .crack .crack-false {
    color: red;
}

`;
    },
    methods: {
        doGetCss() {
            this.$api.style.getApp().then(res => {
                if (res.status === 200 && res.data) {
                    this.cssData = res.data;
                } else {
                    let msg = '接口调用失败';
                    console.error(msg, res);
                    this.$message({message: msg, level: 'error'});
                }
            }).catch(e => {
                let msg = '接口调用失败';
                console.error(msg, e);
                this.$message({message: msg, level: 'error'});
            })
        }
    }
};